ViewCompat
Helper for accessing features in View.
Types
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface OnUnhandledKeyEventListenerCompat
Interface definition for a callback to be invoked when a hardware key event hasn't been handled by the view hierarchy.
Link copied to clipboard
Link copied to clipboard
Properties
Link copied to clipboard
Live region mode specifying that accessibility services should interrupt ongoing speech to immediately announce changes to this view.
Link copied to clipboard
Live region mode specifying that accessibility services should not automatically announce changes to this view.
Link copied to clipboard
Live region mode specifying that accessibility services should announce changes to this view.
Link copied to clipboard
Automatically determine whether a view is important for accessibility.
Link copied to clipboard
The view is not important for accessibility.
Link copied to clipboard
The view is not important for accessibility, nor are any of its descendant views.
Link copied to clipboard
The view is important for accessibility.
Link copied to clipboard
Automatically determine whether a view is important for content capture.
Link copied to clipboard
The view is not important for content capture, but its children (if any) will be traversed.
Link copied to clipboard
The view is not important for content capture, and its children (if any) will not be traversed.
Link copied to clipboard
The view is important for content capture, and its children (if any) will be traversed.
Link copied to clipboard
The view is important for content capture, but its children (if any) will not be traversed.
Link copied to clipboard
Indicates that the view has a hardware layer.
Link copied to clipboard
Indicates that the view does not have a layer.
Link copied to clipboard
Indicates that the view has a software layer.
Link copied to clipboard
Horizontal layout direction of this view is inherited from its parent.
Link copied to clipboard
Horizontal layout direction of this view is from deduced from the default language script for the locale.
Link copied to clipboard
Horizontal layout direction of this view is from Left to Right.
Link copied to clipboard
Horizontal layout direction of this view is from Right to Left.
Link copied to clipboard
Bit shift of MEASURED_STATE_MASK to get to the height bits for functions that combine both width and height into a single int, such as getMeasuredState and the childState argument of resolveSizeAndState.
Link copied to clipboard
Bits of getMeasuredWidthAndState and getMeasuredWidthAndState that provide the actual measured size.
Link copied to clipboard
Bits of getMeasuredWidthAndState and getMeasuredWidthAndState that provide the additional state bits.
Link copied to clipboard
Bit of getMeasuredWidthAndState and getMeasuredWidthAndState that indicates the measured size is smaller that the space the view would like to have.
Link copied to clipboard
Always allow a user to over-scroll this view, provided it is a view that can scroll.
Link copied to clipboard
Allow a user to over-scroll this view only if the content is large enough to meaningfully scroll, provided it is a view that can scroll.
Link copied to clipboard
Never allow a user to over-scroll this view.
Link copied to clipboard
Indicates scrolling along the horizontal axis.
Link copied to clipboard
Indicates no axis of view scrolling.
Link copied to clipboard
Indicates scrolling along the vertical axis.
Link copied to clipboard
Scroll indicator direction for the bottom edge of the view.
Link copied to clipboard
Scroll indicator direction for the ending edge of the view.
Link copied to clipboard
Scroll indicator direction for the left edge of the view.
Link copied to clipboard
Scroll indicator direction for the right edge of the view.
Link copied to clipboard
Scroll indicator direction for the starting edge of the view.
Link copied to clipboard
Scroll indicator direction for the top edge of the view.
Link copied to clipboard
Indicates that the input type for the gesture is caused by something which is not a user touching a screen.
Link copied to clipboard
Indicates that the input type for the gesture is from a user touching the screen.
Functions
Link copied to clipboard
open fun addAccessibilityAction(@NonNull view: View, @NonNull label: CharSequence, @NonNull command: AccessibilityViewCommand): Int
Adds an accessibility action that can be performed on a node associated with a view.
Link copied to clipboard
open fun addKeyboardNavigationClusters(@NonNull view: View, @NonNull views: Collection<View>, direction: Int)
Adds any keyboard navigation cluster roots that are descendants of
view
( including view
if it is a cluster root itself) to views
.Link copied to clipboard
open fun addOnUnhandledKeyEventListener(@NonNull view: View, @NonNull listener: ViewCompat.OnUnhandledKeyEventListenerCompat)
Adds a listener which will receive unhandled KeyEvents.
Link copied to clipboard
Convenience method to add
overlay
to overlayHost
's overlay and assign the disjointParent in the overlay hierarchy.Link copied to clipboard
Cancel the drag and drop operation.
Link copied to clipboard
Check if this view can be scrolled horizontally in a certain direction.
Link copied to clipboard
Check if this view can be scrolled vertically in a certain direction.
Link copied to clipboard
Merge two states as returned by getMeasuredState.
Link copied to clipboard
open fun computeSystemWindowInsets(@NonNull view: View, @NonNull insets: WindowInsetsCompat, @NonNull outLocalInsets: Rect): WindowInsetsCompat
Compute insets that should be consumed by this view and the ones that should propagate to those under it.
Link copied to clipboard
open fun dispatchApplyWindowInsets(@NonNull view: View, @NonNull insets: WindowInsetsCompat): WindowInsetsCompat
Request to apply the given window insets to this view or another view in its subtree.
Link copied to clipboard
Notify a view that its temporary detach has ended; the view is now reattached.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun dispatchNestedPreScroll(@NonNull view: View, dx: Int, dy: Int, @Nullable consumed: Array<Int>, @Nullable offsetInWindow: Array<Int>): Boolean
open fun dispatchNestedPreScroll(@NonNull view: View, dx: Int, dy: Int, @Nullable consumed: Array<Int>, @Nullable offsetInWindow: Array<Int>, type: Int): Boolean
Dispatch one step of a nested scroll in progress before this view consumes any portion of it.
Link copied to clipboard
open fun dispatchNestedScroll(@NonNull view: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: Array<Int>): Boolean
open fun dispatchNestedScroll(@NonNull view: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: Array<Int>, type: Int): Boolean
open fun dispatchNestedScroll(@NonNull view: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: Array<Int>, type: Int, @NonNull consumed: Array<Int>)
Dispatch one step of a nested scroll in progress.
Link copied to clipboard
Notify a view that it is being temporarily detached.
Link copied to clipboard
Allow accessibility services to find and activate clickable spans in the application.
Link copied to clipboard
Generate a value suitable for use in setId.
Link copied to clipboard
Get the current accessibility delegate.
Link copied to clipboard
Gets the live region mode for the specified View.
Link copied to clipboard
Gets the provider for managing a virtual view hierarchy rooted at this View and reported to android.accessibilityservice.AccessibilityServices that explore the window content.
Link copied to clipboard
Get the title of the pane for purposes of accessibility.
Link copied to clipboard
Gets the unique, logical identifier of this view in the activity, for autofill purposes.
Link copied to clipboard
Return the tint applied to the background drawable, if specified.
Link copied to clipboard
Return the blending mode used to apply the tint to the background drawable, if specified.
Link copied to clipboard
Returns a copy of the current setClipBounds.
Link copied to clipboard
Gets the session used to notify content capture events.
Link copied to clipboard
Gets the logical display to which the view's window has been attached.
Link copied to clipboard
The base elevation of this view relative to its parent, in pixels.
Link copied to clipboard
Returns true if this view should adapt to fit system window insets.
Link copied to clipboard
Gets the mode for determining whether this View is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen.
Link copied to clipboard
Gets the mode for determining whether this view is important for autofill.
Link copied to clipboard
Gets the mode for determining whether this view is important for content capture.
Link copied to clipboard
Gets the id of a view for which a given view serves as a label for accessibility purposes.
Link copied to clipboard
Indicates what type of layer is currently associated with this view.
Link copied to clipboard
Returns the resolved layout direction for this view.
Link copied to clipboard
Return the full height measurement information for this view as computed by the most recent call to measure.
Link copied to clipboard
Return only the state bits of getMeasuredWidthAndState and getMeasuredHeightAndState, combined into one integer.
Link copied to clipboard
Return the full width measurement information for this view as computed by the most recent call to measure.
Link copied to clipboard
Returns the minimum height of the view.
Link copied to clipboard
Returns the minimum width of the view.
Link copied to clipboard
Gets the ID of the next keyboard navigation cluster root.
Link copied to clipboard
Returns the MIME types accepted by the listener configured on the given view via setOnReceiveContentListener.
Link copied to clipboard
Returns the over-scroll mode for this view.
Link copied to clipboard
Returns the end padding of the specified view depending on its resolved layout direction.
Link copied to clipboard
Returns the start padding of the specified view depending on its resolved layout direction.
Link copied to clipboard
Gets the parent for accessibility purposes.
Link copied to clipboard
Provide original WindowInsetsCompat that are dispatched to the view hierarchy.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Returns a bitmask representing the enabled scroll indicators.
Link copied to clipboard
Returns the View's state description.
Link copied to clipboard
Link copied to clipboard
Returns the name of the View to be used to identify Views in Transitions.
Link copied to clipboard
The horizontal location of this view relative to its left position.
Link copied to clipboard
The vertical location of this view relative to its top position.
Link copied to clipboard
The depth location of this view relative to its elevation.
Link copied to clipboard
Retrieves a WindowInsetsControllerCompat of the window this view is attached to.
Link copied to clipboard
Returns the current system UI visibility that is currently set for the entire window.
Link copied to clipboard
Checks whether provided View has an accessibility delegate attached to it.
Link copied to clipboard
Returns true if this view is focusable or if it contains a reachable View for which hasExplicitFocusable returns
true
.Link copied to clipboard
Returns true if this view has a nested scrolling parent.
Link copied to clipboard
Returns whether the provided view has an attached View.OnClickListener.
Link copied to clipboard
Returns whether this View has content which overlaps.
Link copied to clipboard
Indicates whether the view is currently tracking transient state that the app should not need to concern itself with saving and restoring, but that the framework should take special note to preserve when possible.
Link copied to clipboard
Gets whether this view is a heading for accessibility purposes.
Link copied to clipboard
Returns true if the provided view is currently attached to a window.
Link copied to clipboard
Returns whether
view
should receive focus when the focus is restored for the view hierarchy containing it.Link copied to clipboard
Computes whether this view should be exposed for accessibility.
Link copied to clipboard
Hints the Android System whether the android.app.assist.AssistStructure.ViewNode associated with this view is considered important for autofill purposes.
Link copied to clipboard
Hints the Android System whether this view is considered important for content capture, based on the value explicitly set by setImportantForContentCapture and heuristics when it's IMPORTANT_FOR_CONTENT_CAPTURE_AUTO.
Link copied to clipboard
Returns whether the view hierarchy is currently undergoing a layout pass.
Link copied to clipboard
Returns whether
view
is a root of a keyboard navigation cluster.Link copied to clipboard
Returns whether layout direction has been resolved.
Link copied to clipboard
Returns true if nested scrolling is enabled for this view.
Link copied to clipboard
Return if the padding as been set through relative values
View.setPaddingRelative(int, int, int, int)
or thruLink copied to clipboard
Returns whether the view should be treated as a focusable unit by screen reader accessibility tools.
Link copied to clipboard
On API 11 devices and above, call
Drawable.jumpToCurrentState()
on all Drawable objects associated with this view.Link copied to clipboard
Link copied to clipboard
Offset this view's horizontal location by the specified amount of pixels.
Link copied to clipboard
Offset this view's vertical location by the specified number of pixels.
Link copied to clipboard
open fun onApplyWindowInsets(@NonNull view: View, @NonNull insets: WindowInsetsCompat): WindowInsetsCompat
Called when the view should apply WindowInsetsCompat according to its internal policy.
Link copied to clipboard
Initializes an AccessibilityEvent with information about this View which is the event source.
Link copied to clipboard
open fun onInitializeAccessibilityNodeInfo(@NonNull v: View, @NonNull info: AccessibilityNodeInfoCompat)
Initializes an AccessibilityNodeInfoCompat with information about this view.
Link copied to clipboard
Called from dispatchPopulateAccessibilityEvent giving a chance to this View to populate the accessibility event with its text content.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun performReceiveContent(@NonNull view: View, @NonNull payload: ContentInfoCompat): ContentInfoCompat
Receives the given content.
Link copied to clipboard
Cause an invalidate to happen on the next animation time step, typically the next display frame.
open fun postInvalidateOnAnimation(@NonNull view: View, left: Int, top: Int, right: Int, bottom: Int)
Cause an invalidate of the specified area to happen on the next animation time step, typically the next display frame.
Link copied to clipboard
Causes the Runnable to execute on the next animation time step.
Link copied to clipboard
Link copied to clipboard
Removes an accessibility action that can be performed on a node associated with a view.
Link copied to clipboard
open fun removeOnUnhandledKeyEventListener(@NonNull view: View, @NonNull listener: ViewCompat.OnUnhandledKeyEventListenerCompat)
Removes a listener which will receive unhandled KeyEvents.
Link copied to clipboard
open fun replaceAccessibilityAction(@NonNull view: View, @NonNull replacedAction: AccessibilityNodeInfoCompat.AccessibilityActionCompat, @Nullable label: CharSequence, @Nullable command: AccessibilityViewCommand)
Replaces an action.
Link copied to clipboard
Ask that a new dispatch of
View.onApplyWindowInsets(WindowInsets)
be performed.Link copied to clipboard
Link copied to clipboard
Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpec.
Link copied to clipboard
Gives focus to the default-focus view in the view hierarchy rooted at
view
.Link copied to clipboard
open fun saveAttributeDataForStyleable(@NonNull view: View, @NonNull context: Context, @NonNull styleable: Array<Int>, @Nullable attrs: AttributeSet, @NonNull t: TypedArray, defStyleAttr: Int, defStyleRes: Int)
Stores debugging information about attributes.
Link copied to clipboard
open fun setAccessibilityDelegate(@NonNull v: View, @Nullable delegate: AccessibilityDelegateCompat)
Sets a delegate for implementing accessibility support via composition (as opposed to inheritance).
Link copied to clipboard
Set if view is a heading for a section of content for accessibility purposes.
Link copied to clipboard
Sets the live region mode for this view.
Link copied to clipboard
open fun setAccessibilityPaneTitle(@NonNull view: View, @Nullable accessibilityPaneTitle: CharSequence)
Visually distinct portion of a window with window-like semantics are considered panes for accessibility purposes.
Link copied to clipboard
Changes the activated state of this view.
Link copied to clipboard
Sets the opacity of the view.
Link copied to clipboard
Sets the hints that help an android.service.autofill.AutofillService determine how to autofill the view with the user's data.
Link copied to clipboard
Sets the unique, logical identifier of this view in the activity, for autofill purposes.
Link copied to clipboard
Set the background of the
view
to a given Drawable, or remove the background.Link copied to clipboard
Applies a tint to the background drawable.
Link copied to clipboard
Specifies the blending mode used to apply the tint specified by setBackgroundTintList to the background drawable.
Link copied to clipboard
Tells the ViewGroup whether to draw its children in the order defined by the method
ViewGroup.getChildDrawingOrder(int, int)
.Link copied to clipboard
Sets a rectangular area on this view to which the view will be clipped when it is drawn.
Link copied to clipboard
open fun setContentCaptureSession(@NonNull v: View, @Nullable contentCaptureSession: ContentCaptureSessionCompat)
Sets the (optional) ContentCaptureSession associated with this view.
Link copied to clipboard
Link copied to clipboard
Sets whether or not this view should account for system screen decorations such as the status bar and inset its content; that is, controlling whether the default implementation of fitSystemWindows will be executed.
Link copied to clipboard
Sets whether
view
should receive focus when the focus is restored for the view hierarchy containing it.Link copied to clipboard
Set whether this view is currently tracking transient state that the framework should attempt to preserve when possible.
Link copied to clipboard
Sets how to determine whether this view is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen.
Link copied to clipboard
Sets the mode for determining whether this view is considered important for autofill.
Link copied to clipboard
Sets the mode for determining whether this view is considered important for content capture.
Link copied to clipboard
Set whether
view
is a root of a keyboard navigation cluster.Link copied to clipboard
Sets the id of a view for which a given view serves as a label for accessibility purposes.
Link copied to clipboard
Updates the Paint object used with the current layer (used only if the current layer type is not set to LAYER_TYPE_NONE).
Link copied to clipboard
Specifies the type of layer backing this view.
Link copied to clipboard
Set the layout direction for this view.
Link copied to clipboard
Enable or disable nested scrolling for this view.
Link copied to clipboard
Sets the ID of the next keyboard navigation cluster root view.
Link copied to clipboard
open fun setOnApplyWindowInsetsListener(@NonNull view: View, @Nullable listener: OnApplyWindowInsetsListener)
Set an OnApplyWindowInsetsListener to take over the policy for applying window insets to this view.
Link copied to clipboard
open fun setOnReceiveContentListener(@NonNull view: View, @Nullable mimeTypes: Array<String>, @Nullable listener: OnReceiveContentListener)
Sets the listener to be used to handle insertion of content into the given view.
Link copied to clipboard
Set the over-scroll mode for this view.
Link copied to clipboard
Set the pointer icon for the current view.
Link copied to clipboard
Sets the degrees that the view is rotated around the pivot point.
Link copied to clipboard
Sets the degrees that the view is rotated around the horizontal axis through the pivot point.
Link copied to clipboard
Sets the degrees that the view is rotated around the vertical axis through the pivot point.
Link copied to clipboard
Controls whether the entire hierarchy under this view will save its state when a state saving traversal occurs from its parent.
Link copied to clipboard
Sets whether this View should be a focusable element for screen readers and include non-focusable Views from its subtree when providing feedback.
Link copied to clipboard
Sets the state of all scroll indicators.
Sets the state of the scroll indicators specified by the mask.
Link copied to clipboard
Sets the state description of this node.
Link copied to clipboard
Link copied to clipboard
Sets the tooltip for the view.
Link copied to clipboard
Sets the name of the View to be used to identify Views in Transitions.
Link copied to clipboard
Sets the horizontal location of this view relative to its left position.
Link copied to clipboard
Sets the vertical location of this view relative to its top position.
Link copied to clipboard
Sets the depth location of this view relative to its elevation.
Link copied to clipboard
open fun setWindowInsetsAnimationCallback(@NonNull view: View, @Nullable callback: WindowInsetsAnimationCompat.Callback)
Sets a WindowInsetsAnimationCompat.Callback to be notified about animations of windows that cause insets.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Stop a nested scroll in progress.
Link copied to clipboard
Update the drag shadow while drag and drop is in progress.